#訪問網站
#檢查網站是否是開啟狀態，應用程序是否是開啟狀態，都開啟則訪問網站，

[string[]]$logInfo = @()

#脚本加载开始
."$PSScriptRoot\setting.ps1";
."$PSScriptRoot\methods.ps1";
."$PSScriptRoot\visit.ps1";

#執行更新命令
Main  $iis_webSite_r 

#導出文件
$Global:logInfo | out-file $logfileName
$Global:logInfo = @()

if([System.DateTime]::Now.Hour -eq 1)
{
      #刪除小於今天的日誌文件
    Get-WriteLog('')
    Get-WriteLogFormat('Delete Log - Running')
    $defiles = Get-DirFileByLtToday $logdir
    if($defiles -eq $null)
    {
        Get-WriteLog('not delete file...')   
    }else{
        foreach($file in $defiles)
        {
            Remove-Item $file
            Get-WriteLog('delete file: ' + $file) 
        }
    }
    Get-WriteLogFormat('Delete Log - End')
    Get-WriteLog('')

    $Global:logInfo | out-file -Append $logfileName
    $Global:logInfo = @()
}